package com.servlet;

import com.dao.UserInfDao;
import com.dao.searchdao;
import com.dao.searchdaoimpl;
import com.entity.productdetails;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class zuhao extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String s=req.getParameter("tiaozhuan");
        String sql="select * from productdetails";
        UserInfDao u=new UserInfDao();
        List<productdetails> list= new ArrayList<>();
        List<productdetails> list1 = u.getForList(productdetails.class,sql);
        for (productdetails productdetail : list1) {
            if (s.equals(productdetail.getPDID())) {
                list.add(productdetail);
            }
        }
        req.setAttribute("gmsg",list);
        req.getRequestDispatcher("/youxixiangqing.jsp").forward(req,resp);
    }
}
